<style lang="less">
    @import "./main.less";
    .ivu-modal-content{
        background-color: #0f1837 !important;
    }
</style>
<template>
    <div class="main">
        <div class="main-header-con" style="paddingLeft: 0px">
            <div class="main-header">

                <!--<Avatar :icon="'paper-airplane'" style="background: #A8E037;margin-left: 10px;"></Avatar>-->

                <div class="navicon-con">
                    <img src="src/images/lk_logo_txt.png"height="50px">
                </div>
                <div class="header-avator-con">
                    <div style="margin: 12px;">
                        <tags-page-opened></tags-page-opened>
                    </div>
                    <div class="user-dropdown-menu-con">
                        <Row type="flex" justify="end" align="middle" class="user-dropdown-innercon">
                            <Dropdown transfer trigger="click" @on-click="handleClickUserDropdown">
                                <a href="javascript:void(0)">
                                    <span class="main-user-name">{{ userName }}</span>
                                    <Icon type="arrow-down-b"></Icon>
                                </a>
                                <DropdownMenu slot="list">
                                    <!--<DropdownItem name="ownSpace">个人中心</DropdownItem>-->
                                    <DropdownItem name="loginout" >退出登录</DropdownItem>
                                </DropdownMenu>
                            </Dropdown>
                        </Row>
                    </div>
                </div>
            </div>
            <div class="main-header-title" style="border: 0;">
                <div class="navicon-con" style="text-align: center">
                    <p>{{content}}</p>
                </div>
            </div>

        </div>
        <div class="single-page-con" style="left: 0px">
            <div class="single-page">
                <router-view></router-view>
            </div>
        </div>
        <footer class="footer-con">
            <div class="footer-content">龙考志愿-高考志愿填报竞争情报分析系统&nbsp;&copy;&nbsp;2018&nbsp;&nbsp;技术支持：二楼后座&nbsp;<a href="#">联系我们</a>
            </div>
        </footer>
    </div>
</template>
<script>
    import tagsPageOpened from './main-components/tags-page-opened.vue';
    import Cookies from 'js-cookie';
    import util from '@/libs/util.js';
    import {exam} from '../../api/index.js';
    export default {
        components: {
            tagsPageOpened
        },
        data() {
            return {
                userName: '',
                content:''

           };
        },
        computed: {},
        methods: {
            init() {
                exam.getStudentAll_get().then((res)=> {
                    if(res.data.resCode!=0){
                        this.$Message.error(res.data.resMsg);
                    }else{
                        this.userName = res.data.data.user.userName;
                        var studentCode = res.data.data.student.studentCode;
                        var wlType = res.data.data.student.wlType;
                        var zfScore = res.data.data.student.zfScore;
                        var dnPm = res.data.data.student.dnPm;
                        if(wlType=="WK"){
                            wlType="文科";
                        }else if(wlType=="LK"){
                            wlType="理科";
                        }
                        this.content = studentCode+"、"+wlType+"、"+"总分"+zfScore+"分、"+"全省排名"+dnPm+"名";
                    }
                }, function (error) {
                    alert("系统异常，请先联系管理员");
                });
            },
            handleClickUserDropdown(name) {
                if (name === 'ownSpace') {
                    util.openNewPage(this, 'ownspace_index');
                    this.$router.push({
                        name: 'ownspace_index'
                    });
                } else if (name === 'loginout') {
                    exam.loginOut_post().then((res)=> {
                        if(res.data.resCode!=0){
                            this.$Message.error(res.data.resMsg);
                        }else{
                            this.$router.push({
                                name: 'login'
                            });
                        }
                    }, function (error) {
                        alert("系统异常，请先联系管理员");
                    });
                }
            }
        },
        watch: {
            '$route'(to) {
            }
        },
        mounted() {
            this.init();
        },
        created() {
            // 显示打开的页面的列表
        }
    };
</script>
